package com.ry.demo.concurrent.demo.base;

/**
 * @Author: lihui
 * @Date: 2021-12-02 09:44
 * @Description:
 */
public class ThreadErrorDemo {

    static class A {
        public static void main(String[] args) {

             final int SHARED_SHIFT   = 16;
             final int SHARED_UNIT    = (1 << SHARED_SHIFT);
            System.out.println(SHARED_UNIT);

        }
    }



    public static void main(String[] args) {

        new Thread(()->{

            while (true){
                System.out.println("执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                try {
                    int a = 2/0;
                } catch (Exception e) {

                    e.printStackTrace();
                }

            }

        });

        System.out.println("执行");

        try {
            int a = 2/0;
        } catch (Exception e) {
            // 只是打印堆栈异常信息，相当于吞了这次异常，没有往外抛
            e.printStackTrace();
        }

        System.out.println("执行结束");


    }

}
